<!DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <title>vue html demo</title>
    <script src="./lib/vue-2.4.0.js"></script>
    <script src="./lib/vue-resource-1.3.4.js"></script>
    </head>
    <body>
        <div id="app">
            <button @click="getInfo">
                get
            </button>
            <button @click="postInfo">
                    post
                </button>
                <button @click="jsonp">
                        post
                    </button>
        </div>
        <script>
          var vm = new Vue({
                el: '#app',
                data: {

                },
                methods:{

                    getInfo(){
                        this.$http.get('http://www.liulongbin.top:3005/api/getlunbo').then(function (result){
                        //    通过 result.body 拿到服务器返回的成功数据
                            console.log(result.body)
                        })
                    },
                    postInfo(){
                        this.$http.post('http://www.liulongbin.top:3005/api/post', {}, {emulateJSON: true}).then(result => {
                            console.log(result.body)
                        })
                        },
                    jsonp() {
                        this.$http.jsonp('http://www.liulongbin.top:3005/api/jsonp').then(result => {
                            console.log(result.body)
                        })
                    }
                    
                }
            })
        </script>
    </body>
</html>